package servlet;

import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 东北
 * @date 2022/7/11
 * @apiNote
 */
@WebServlet("/my")
public class MyServlet extends HttpServlet {
    // alt + enter 引入类
    // alt + Insert 生成代码

    int i = 100;
    public void test(){
        i++;
    }

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {

        i *= 2;
        System.out.println(i);
        res.setContentType("text/html;charset=UTF-8");
        res.setCharacterEncoding("utf-8");
        PrintWriter out = res.getWriter();
        out.write(i);
    }
}
